<!-- 变更申请弹窗 -->
<template>
  <el-container class="wrapper">
    <el-main>
      <el-row class="info-wrapper">
        <el-col :span="24" class="info-col">
          <span> 项目名称: </span>
          <small>{{ researchInfo.title }}</small>
        </el-col>
        <el-col :span="12" class="info-col">
          <span>申请人： </span>
          <small>{{ userInfo.name }}</small>
        </el-col>
        <el-col :span="12" class="info-col">
          <span>申请时间:</span>
          <small>{{ new Date() | date }}</small>
        </el-col>
        <el-col :span="24" class="info-col flex ">
          <span>变更原因</span>
          <el-input
            v-model="formData.remark"
            type="textarea"
            :rows="4"
            placeholder="请输入内容"
          />
        </el-col>
      </el-row>
    </el-main>
    <el-footer class="tag-footer">
      <el-button
        size="mini"
        type="primary"
        :loading="submitButtonLoading"
        @click="submit"
      >提 交</el-button>
    </el-footer>
  </el-container>
</template>

<script>
import { mixins_base, } from '@/minxins/project';
import { mapState, } from 'vuex';
import ProjectAPI from '@/apis/project';
export default {
  mixins: [mixins_base],
  data() {
    return {
      formData: {
        itemCode: '',
        remark: '',
      },
      submitButtonLoading: false,
    };
  },
  computed: {
    ...mapState('login', ['userInfo']),
  },
  mounted() {
  },

  methods: {

    async submit() {
      try {
        this.submitButtonLoading = true;
        this.formData.itemCode = this.researchInfo.itemCode;
        await ProjectAPI.impose.changeApply(this.formData, 'apply');
        this.submitButtonLoading = false;
        this.$message.success('操作成功');
        this.$emit('done');
      } catch (e) {
        this.submitButtonLoading = false;
        this.$message.error(e);
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.flex{
  display: flex;
   >span{
     flex: none !important;
     margin-right: 16px;
   }
}

.info {
  &-wrapper {
    span,
    small {
      font-size: 18px;
      font-weight: 400;
      display: inline-block;
    }
    span {
      color: #879bba;
    }
    small {
      color: #2d405e;
    }
  }
  &-col {
    margin-bottom: 16px;
  }
}
.tag {
  &-footer {
    padding: 0;
    margin: 0;
    text-align: right;
    line-height: 60px;
  }
}
</style>
